/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.util.Pair;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.GranteeType;
/*    */ import com.zimbra.cs.account.accesscontrol.RightCommand;
/*    */ import com.zimbra.cs.account.accesscontrol.RightCommand.AllEffectiveRights;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import com.zimbra.soap.admin.type.GranteeSelector.GranteeBy;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class GetAllEffectiveRights
/*    */   extends RightDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 38 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/*    */     
/* 40 */     Pair<Boolean, Boolean> expandAttrs = parseExpandAttrs(request);
/* 41 */     boolean expandSetAttrs = ((Boolean)expandAttrs.getFirst()).booleanValue();
/* 42 */     boolean expandGetAttrs = ((Boolean)expandAttrs.getSecond()).booleanValue();
/*    */     
/* 44 */     Element eGrantee = request.getOptionalElement("grantee");
/*    */     String grantee;
/*    */     String granteeType;
/*    */     GranteeSelector.GranteeBy granteeBy;
/* 48 */     String grantee; if (eGrantee != null) {
/* 49 */       String granteeType = eGrantee.getAttribute("type", GranteeType.GT_USER.getCode());
/* 50 */       GranteeSelector.GranteeBy granteeBy = GranteeSelector.GranteeBy.fromString(eGrantee.getAttribute("by"));
/* 51 */       grantee = eGrantee.getText();
/*    */     } else {
/* 53 */       granteeType = GranteeType.GT_USER.getCode();
/* 54 */       granteeBy = GranteeSelector.GranteeBy.id;
/* 55 */       grantee = zsc.getRequestedAccountId();
/*    */     }
/*    */     
/* 58 */     GranteeType gt = GranteeType.fromCode(granteeType);
/* 59 */     if (!grantee.equals(zsc.getAuthtokenAccountId())) {
/* 60 */       checkCheckRightRight(zsc, gt, granteeBy, grantee);
/*    */     }
/*    */     
/* 63 */     RightCommand.AllEffectiveRights aer = RightCommand.getAllEffectiveRights(Provisioning.getInstance(), granteeType, granteeBy, grantee, expandSetAttrs, expandGetAttrs);
/*    */     
/*    */ 
/*    */ 
/*    */ 
/* 68 */     Element resp = zsc.createElement(AdminConstants.GET_ALL_EFFECTIVE_RIGHTS_RESPONSE);
/* 69 */     aer.toXML(resp);
/* 70 */     return resp;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 75 */     relatedRights.add(Rights.Admin.R_checkRightUsr);
/* 76 */     relatedRights.add(Rights.Admin.R_checkRightGrp);
/*    */     
/* 78 */     notes.add("If grantee to check for is an account, needs the " + Rights.Admin.R_checkRightUsr.getName() + " right");
/* 79 */     notes.add("If grantee to check for is a group, needs the " + Rights.Admin.R_checkRightGrp.getName() + " right");
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/GetAllEffectiveRights.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */